home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / blankery / blanker / source / blankers / dragon / blank.c next >
C/C++ Source or Header  |  1993-08-15  |  1KB  |  57 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3. #include <dos/dos.h>
  4.  
  5. #include <clib/exec_protos.h>
  6. #include <clib/intuition_protos.h>
  7. #include <clib/graphics_protos.h>
  8. #include <clib/alib_protos.h>
  9.  
  10. #include <math.h>
  11.  
  12. #include "/defs.h"
  13. #include "/utility.h"
  14.  
  15. extern    ULONG    Mode;
  16.  
  17. VOID Dragon( struct Screen *Scr, SHORT Wid, SHORT Hei )
  18. {
  19.     SHORT    i, flg_end = FALSE;
  20.     float    xx, yy, x = 0, y = 0;
  21.     float    t = (float)( RangeRand( 100 ) + 10 ), a = M_PI - t / 5000;
  22.  
  23.     SetRGB4(&( Scr->ViewPort ), 1, RangeRand( 14 ) + 1, RangeRand( 14 ) + 1, RangeRand( 14 ) + 1 );
  24.     SetRast(&( Scr->RastPort ), 0 );
  25.     ScreenToFront( Scr );
  26.  
  27.     for( i = 0; i < 40000 && !flg_end; i++ ) {
  28.         if(!( i % 100 )) flg_end = SetSignal( 0L ,0L ) & SIGBREAKF_CTRL_C;
  29.  
  30.         xx = y - sin( x );
  31.         yy = a - x;
  32.  
  33.         WritePixel(&( Scr->RastPort ), Wid / 2 + (SHORT)( 2.0 * x ), Hei / 2 + (SHORT)( 2.0 * y ));
  34.  
  35.         x = xx;
  36.         y = yy;
  37.     }
  38. }
  39.  
  40. VOID blank( VOID )
  41. {
  42.     struct Screen *Scr;
  43.  
  44.     if( Scr = OpenScreenTags( NULL, SA_Depth, 2, SA_Overscan, OSCAN_STANDARD, SA_DisplayID, Mode, SA_Quiet,
  45.         TRUE, SA_Behind, TRUE, TAG_DONE )) {
  46.  
  47.         SetRGB4(&( Scr->ViewPort ), 0, 0, 0, 0 );
  48.         BlankMousePointer();
  49.  
  50.         while(!( SetSignal( 0L ,0L ) & SIGBREAKF_CTRL_C )) Dragon( Scr, Scr->Width, Scr->Height );
  51.  
  52.         SetSignal( 0L, SIGBREAKF_CTRL_C );
  53.         UnblankMousePointer();
  54.         CloseScreen( Scr );
  55.     }
  56. }
  57.